using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Diagnostics;

namespace ResourceBlender_Express {
    /// <summary>
    /// The 'About ResourceBlender' dialog.
    /// </summary>
    public partial class WinAbout : Window {
        /// <summary>
        /// Initializes a new <see cref="WinAbout"/>.
        /// </summary>
        public WinAbout() {
            InitializeComponent();
        }

        /// <summary>
        /// Sets the version and build date text when the window loads.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void Window_Loaded(object sender, RoutedEventArgs e) {
            lblVersion.Text = Constants.GetVersion().ToString(3);
            lblDate.Text = Constants.BuildDate.ToLocalTime().ToString("d/MM/yyyy HH:mm");
        }

        /// <summary>
        /// Closes the window.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void CloseWindow(object sender, RoutedEventArgs e) {
            Close();
        }

        /// <summary>
        /// Opens a URL.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Navigation.RequestNavigateEventArgs"/> instance containing the event data.</param>
        private void OpenURL(object sender, System.Windows.Navigation.RequestNavigateEventArgs e) {
            string url = e.Uri.ToString();
            if(url.Length > 0) {
                Process.Start(url);
            }
        }
    }
}
